<h1><?php echo $title_for_layout = __d('lil_ads', 'Edit/Add Location', true); ?></h1>
<div class="locations form">
<?php echo $this->Form->create('AdsLocation');?>
	<fieldset>
	<?php
		echo $this->Form->input('id');
		echo $this->Form->input('title', array(
			'label' => __d('lil_ads', 'Title', true) . ':',
			'error' => __d('lil_ads', 'Title is required.', true),
			'class' => 'big'
		));
		
		echo $this->Form->input('std_sizes', array(
			'options' =>  array(
				__d('lil_ads', 'Horizontal', true) => array(
					'728x90' => __d('lil_ads', 'Leaderboard (728x90 px)', true),
					'468x60' => __d('lil_ads', 'Full Banner (468x60 px)', true),
					'234x60' => __d('lil_ads', 'Half Banner (234x60 px)', true),
				),
				__d('lil_ads', 'Boxes', true) => array(
					'336x280' => __d('lil_ads', 'Large Rectangle (336x280 px)', true),
					'300x250' => __d('lil_ads', 'Medium Rectangle (300x250 px)', true),
					'180x150' => __d('lil_ads', 'Rectangle (180x150 px)', true),
					'125x125' => __d('lil_ads', 'Square Button (125x125 px)', true),
					'88x31'   => __d('lil_ads', 'Micro Bar (88x31 px)', true),
				),
				__d('lil_ads', 'Vertical', true) => array(
					'120x600'   => __d('lil_ads', 'Skyscraper (120x600 px)', true),
					'160x600'   => __d('lil_ads', 'Wide Skyscraper (160x600 px)', true),
				)
			),
			'label'   => __d('lil_ads', 'Standard sizes', true) . ':',
			'empty'   => __d('lil_ads', '-- use custom size --', true)
		));
		
		echo $this->Form->input('width', array('label'=>__d('lil_ads', 'Width', true).':', 'error' => __d('lil_ads', 'Width has to be numeric.', true)));
		echo $this->Form->input('height', array('label'=>__d('lil_ads', 'Height', true).':', 'error' => __d('lil_ads', 'Height has to be numeric.', true)));
		
		echo $this->Form->input('accept_image', array('label'=>__d('lil_ads', 'Accept images (gif, jpg, png)', true)));
		echo $this->Form->input('accept_flash', array('label'=>__d('lil_ads', 'Accept flash (swf)', true)));
		echo $this->Form->input('accept_html', array('label'=>__d('lil_ads', 'Accept HTML', true)));
		echo $this->Form->input('accept_plain', array('label'=>__d('lil_ads', 'Accept plain text', true)));
	?>
	</fieldset>
	<?php echo $this->Form->end(__d('lil_ads', 'OK', true));?>
</div>

<?php echo $html->script('/lil_ads/js/jquery-1.4.2.min'); ?>
<script type="text/javascript">
	$(document).ready(function() {
		var loc_dim = '<?php echo $html->value('Location.width') . 'x' . $html->value('Location.height'); ?>';
		if ($('#LocationStdSizes option[value="' + loc_dim + '"]')) $('#LocationStdSizes').val(loc_dim);
		
		$('#LocationStdSizes').change(function() {
			var lss = $(this).val().split('x');
			if (typeof(lss[1]) != 'undefined') {
				$('#LocationWidth').val(lss[0]);
				$('#LocationHeight').val(lss[1]);
			}
		});
		
		var LocChange;
		LocChange = function() {
			var loc_dim_l = $('#LocationWidth').val() + 'x' + $('#LocationHeight').val();
			if ($('#LocationStdSizes option[value="' + loc_dim_l + '"]').get(0)) {
				$('#LocationStdSizes').val(loc_dim_l);
			} else {
				$('#LocationStdSizes').val('');
			}
		};
		
		$('#LocationWidth').keyup(LocChange);
		$('#LocationHeight').keyup(LocChange);
	});
</script>